package tcp.common;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

class TCPClient {

  public static void main(String[] args) throws Exception {
    //创建Socket服务
    Socket s = new Socket("192.168.10.6", 10000);

    //获取Socket中的输出流
    OutputStream out = s.getOutputStream();
    out.write("This is message from client！".getBytes());

    //接受从服务端的反馈信息
    InputStream in = s.getInputStream();
    byte[] buf = new byte[1024];
    int len = in.read(buf);
    System.out.println(new String(buf, 0, len));
    s.close();
  }
}
